{extend name="public:base"}
{block name='css'}
<link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
{/block}
{block name="js"}
<script src="__PUBLIC__/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__PUBLIC__/js/content.min.js?v=1.0.0"></script>
<script type="text/javascript">

    function ajaxsubmit(self){
        if ($(self).hasClass('ed')) {
            return false;
        }
        $(self).addClass('ed');
        var obj = showMyLoading();
        $.post("{:url('savesort')}", $(self).serialize(), function(data){
            hideMyLoading(obj);
            layer.msg(data.info);
            if (data.status == 'y') {
                window.location.reload();
            } else {
                $(self).removeClass('ed');
            }
        }, 'json');
    }
</script>
{/block}
{block name='body'}

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>链接管理</h5>
						<a href="{:url('add')}" class="btn btn-sm btn-primary pull-right m-t-n-xs">添加链接</a>
                    </div>
                    <div class="ibox-content">
						<form name="form" action="{:url('saveSort')}"  method="post" onsubmit="ajaxsubmit(this);return false;" >
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>名称</th>
                                    <th>控制器</th>
                                    <th>方法</th>
                                    <th>参数</th>
                                    <th>ICO图标</th>
                                    <th>排序</th>
                                    <th>添加时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
								{foreach name="list" item="li"}
                                <tr>
                                    <td>{$li.html}{$li.title}</td>
                                    <td>{$li.controller}</td>
                                    <td>{$li.action}</td>
                                    <td>{$li.params}</td>
                                    <td><i class="fa fa-{$li.ico}" ></i></td>
                                    <td><input type="text"  style="width:60px;text-align:center;" name="{$li.id}" value="{$li.sort}" class="form-control"></td>
                                    <td>{$li.time|date="Y-m-d H:i:s",###}</td>
                                    <td>
										<a href="{:url('save',array('id'=>$li['id']))}" class="btn btn-primary btn-xs edit"><i class="fa fa-edit"></i> 编辑</a>
	                                    <a href="javascript:;" onclick="return del({$li.id});" class="btn btn-danger btn-xs delete"><i class="fa fa-trash-o"></i> 删除</a>
									</td>
                                </tr>
								{/foreach}
                            </tbody>
							<tfoot>
								<tr>
                                    <td colspan="5">&nbsp;</td>
                                    <td colspan="3">
										<input type="submit" class="btn btn-sm btn-primary m-t-n-xs" value="修改排序" />
									</td>
                                </tr>
							</tfoot>
                        </table>
						</form>
                    </div>
                </div>
            </div>
        </div>
        
    </div>
    
</body>
{/block}
